- name: Copy in the sync-fedora-web cronjob
  copy: src=cron-sync-fedora-web dest=/etc/cron.d/sync-fedora-web
  tags:
  - fedora-web
  - fedora-web/main

- name: Copy some config files for {{website}}
  copy: >
    src={{item}} dest=/etc/httpd/conf.d/{{website}}/{{item}}
    owner=root group=root mode=0644
  with_items:
  - fedora-web.conf
  - languages.conf
  - cache.conf
  - persona.conf
  - hotspot.conf
  - expires.conf
  - deflate.conf
  - mattdm-google-validate.conf
  notify:
  - reload proxyhttpd
  tags:
  - fedora-web
  - fedora-web/main
  - fedora-web/hotspot
  - fedora-web/google-site-verification

- name: And one template (for {{website}})
  template: >
    src={{item}} dest=/etc/httpd/conf.d/{{website}}/{{item}}
    owner=root group=root mode=0644
  with_items:
  - sponsor.conf
  notify:
  - reload proxyhttpd
  tags:
  - fedora-web
  - fedora-web/main

- name: Create a file for hotspot
  copy: dest=/srv/web/hotspot.txt content="OK"
        owner=root group=root mode=0644
        setype=httpd_sys_content_t
  tags:
  - fedora-web
  - fedora-web/main
  - fedora-web/hotspot

# create google validation for mattdm. See https://pagure.io/fedora-websites/issue/729

- name: Create a file for google validation
  copy: dest=/srv/web/google4ddeb43aa58b0de1.html src=google4ddeb43aa58b0de1.html
        owner=root group=root mode=0644
        setype=httpd_sys_content_t
  tags:
  - fedora-web
  - fedora-web/main
  - fedora-web/google-site-verification

- name: And, copy over a template for browserid
  template: >
    src=browserid.fedoraproject.org dest=/srv/web/browserid.fedoraproject.org
    owner=root group=root mode=0644
  notify:
  - reload proxyhttpd
  tags:
  - fedora-web
  - fedora-web/main

# TODO -- turn these into redirects in playbooks/groups/proxies-redirect.yml
- name: Copy over some miscellaneous redirects (for stg)
  copy: >
    src=redirects.conf.stg dest=/etc/httpd/conf.d/{{website}}/redirects.conf
    owner=root group=root mode=0644
  when: env == "staging"
  notify:
  - reload proxyhttpd
  tags:
  - fedora-web
  - fedora-web/main

# TODO -- turn these into redirects in playbooks/groups/proxies-redirect.yml
- name: Copy over some miscellaneous redirects (for prod)
  copy: >
    src=redirects.conf.prod dest=/etc/httpd/conf.d/{{website}}/redirects.conf
    owner=root group=root mode=0644
  when: env != "staging"
  notify:
  - reload proxyhttpd
  tags:
  - fedora-web
  - fedora-web/main
